package cn.topevery.garden.dal.dao.impl;

import cn.topevery.garden.dal.dao.GpsPosCurrStatusDao;
import cn.topevery.garden.entity.po.GpsPosCurrStatus;
import cn.topevery.garden.entity.query.GpsPosCurrStatusQuery;
import cn.topevery.garden.entity.vo.GpsPosCurrStatusVO;
import cn.topevery.garden.framework.base.BaseDaoImpl;
import hw.topevery.framework.db.entity.DataPager;
import hw.topevery.framework.db.entity.SqlQueryMate;
import hw.topevery.framework.db.enums.ScriptConditionEnum;
import org.springframework.stereotype.Repository;

/**
 * 
 *
 * @author code-generate
 * @date 2021-08-30
 */
@Repository
public class GpsPosCurrStatusDaoImpl extends BaseDaoImpl<GpsPosCurrStatus> implements GpsPosCurrStatusDao {

    @Override
    public DataPager<GpsPosCurrStatusVO> listPage(GpsPosCurrStatusQuery query) {
        String table = "t_gps_pos_curr_status tgpcs";

        String columns = "tgpcs.*";
        int pageIndex = query.pageIndex - 1;
        int pageSize = query.pageSize;

        SqlQueryMate sqlQueryMate = new SqlQueryMate(table).setColumns(columns).setOrderBy("tgpcs.c_id desc");
        sqlQueryMate
                .where(true, "tgpcs.c_db_status", ScriptConditionEnum.Eq, 0)
        ;

        return getDataPager(sqlQueryMate, pageSize, pageIndex, GpsPosCurrStatusVO.class);
    }
}
